package com.corpgovernment.organization.mapper;


import com.corpgovernment.organization.common.mybatis.TkMapper;
import com.corpgovernment.organization.entity.db.MbOrgUserIdcard;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * MbOrgUserIdcardMapper数据库操作接口类
 *
 * @author wangyujue
 */
@Repository
public interface MbOrgUserIdcardMapper extends TkMapper<MbOrgUserIdcard> {


    /**
     * 根据type和no查询证件信息
     *
     * @param type
     * @param cardNo
     * @return
     */
    List<MbOrgUserIdcard> listEmployeeByTypeAndNo(@Param("type") Integer type, @Param("cardNo") String cardNo);

    /**
     * 批量查询用户证件信息
     *
     * @param uids
     * @return
     */
    List<MbOrgUserIdcard> listByUids(@Param("uids") List<String> uids);

    /**
     * 批量查询非员工证件信息
     *
     * @param nonEmployeeUids
     * @return
     */
    List<MbOrgUserIdcard> listByNonEmployeeUids(@Param("nonEmployeeUids") List<Long> nonEmployeeUids);

    /**
     * 批量保存
     *
     * @param needAddList
     * @return
     */
    int batchSave(@Param("needAddList") List<MbOrgUserIdcard> needAddList);

    /**
     * 修改非员工证件
     *
     * @param mbOrgUserIdcard
     * @return
     */
    int updateByNonEmployeeUid(MbOrgUserIdcard mbOrgUserIdcard);

    /**
     * 通过员工uid更新用户证件
     *
     * @param mbOrgUserIdcard
     * @return
     */
    int updateByEmployeeUid(MbOrgUserIdcard mbOrgUserIdcard);

    /**
     * 删除员工证件
     *
     * @param uid
     * @return
     */
    int deleteByEmployeeUid(@Param("uid") String uid);

    /**
     * 删除非员工证件
     *
     * @param nonEmployeeUid
     * @return
     */
    int deleteByNonEmployeeUid(Long nonEmployeeUid);

	List<MbOrgUserIdcard> findAllCardNo();

    /**
     * 批量更新证件信息
     * @param cardList
     * @return
     */
	int updateBatchSelective(List<MbOrgUserIdcard> cardList);
}